import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ShadowWidget extends StatelessWidget {
  final Widget child;
  final double? height;
  final double marginHorizontal;
  final double marginVertical;
  final double marginTop;
  final double marginBottom;
  final double marginLeft;
  final double marginRight;
  final double paddingHorizontal;
  final double paddingVertical;
  final double radius;
  final Color? shadowColor;
  final Color? backgroundColor;

  const ShadowWidget.fixedHeight({
    Key? key,
    required this.child,
    this.height,
    this.marginHorizontal = 0,
    this.marginVertical = 0,
    this.marginTop = 0,
    this.marginBottom = 0,
    this.marginLeft = 0,
    this.marginRight = 0,
    this.paddingHorizontal = 0,
    this.paddingVertical = 0,
    this.radius = 12,
    this.shadowColor,
    this.backgroundColor,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      height: (null == height) ? null : height?.h,
      margin: EdgeInsets.only(
        top: (marginVertical.h > 0) ? marginVertical.h : marginTop.h,
        bottom: (marginVertical.h > 0) ? marginVertical.h : marginBottom.h,
        left: (marginHorizontal.w > 0) ? marginHorizontal.w : marginLeft.w,
        right: (marginHorizontal.w > 0) ? marginHorizontal.w : marginRight.w,
      ),
      padding: EdgeInsets.symmetric(
        horizontal: paddingHorizontal.w,
        vertical: paddingVertical.h,
      ),
      decoration: BoxDecoration(
          color: backgroundColor,
          borderRadius: BorderRadius.all(
            Radius.circular(radius.r),
          ),
          boxShadow: [
            BoxShadow(
                color: shadowColor ?? const Color(0x80dadfe8),
                offset: Offset(
                  0,
                  2.h,
                ),
                blurRadius: 10.w,
                spreadRadius: 0.0),
            BoxShadow(
                // color: ThemeUtils.getShadowColor(context),
                color: const Color(0x4dbac4e1),
                offset: Offset(
                  1.w,
                  2.h,
                ),
                blurRadius: 10.w,
                spreadRadius: 0.0),
          ]),
      child: child,
    );
  }
}
